package com.example.function.pool.model.pojo;


import com.example.common.support.ApplicationContextProvider;
import com.example.function.pool.model.one.CarModel;
import com.example.function.pool.service.ICarModelService;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Description: <CarModelPojo vo>. <br>
 * <p>
 * generate time:2021-7-26 15:43:23
 *
 * @author hanqf
 * @version V1.0
 */
@Data
public class CarModelPojo implements Serializable {
    private static final long serialVersionUID = 1L;

    /*
     * 车型id
     */
    private Long id;


    /*
     * 车型名称
     */
    private String carmodelName;


    /*
     * 内部代号
     */
    private String carmodelCode;


    /*
     * 更新时间
     */
    private java.util.Date carmodelModifyTime;


    /*
     * 备注
     */
    private String carmodelRemark;


    /*
     * 创建人id
     */
    private Long userId;


    /*
     * 项目id
     */
    private Long projectId;


    /**
     * 实体对象复制到数据对象
     */
    public static CarModelPojo wrapper(CarModel carModel) {
        CarModelPojo carModelPojo = new CarModelPojo();
        BeanUtils.copyProperties(carModel, carModelPojo);
        final ICarModelService carModelService = (ICarModelService) ApplicationContextProvider.getBean("carModelService");

        return carModelPojo;
    }

    public static List<CarModelPojo> wrapper(List<CarModel> carModels) {
        List<CarModelPojo> carModelPojoList = new ArrayList<>();
        for(CarModel carModel:carModels){
            carModelPojoList.add(CarModelPojo.wrapper(carModel));
        }
        return carModelPojoList;
    }
}



